const webpack = require('webpack');
const { merge } = require('webpack-merge');
const commonConfig = require('./webpack.common.js');

const devConfig = {
	mode: 'development',
	devtool: 'cheap-module-eval-source-map',
	devServer: {
		contentBase: '/',
		open: true,
		port: 8080,
		hot: true
	},
	module: {
		rules: [
			{
				test: /\.less$/,
				use: [
				  "style-loader", // creates style nodes from JS strings
				  "css-loader", // translates CSS into CommonJS
				  "less-loader", // compiles Less to CSS
				],
			  },
			  {
				test: /\.css$/,
				use: [
				  "style-loader",
				  "css-loader", 
				  "postcss-loader"
				],
			  },
		]
	},
	plugins: [
		new webpack.HotModuleReplacementPlugin()
	],
}

module.exports = merge(commonConfig, devConfig);